package com.game;

import com.game.packet.Packet;
import com.game.packet.PacketType;
import com.nets.client.Client;
import com.nets.pool.ClientPool;

import java.util.concurrent.TimeUnit;

/**
 * @author sig
 * @since 2016/9/24
 */
public class ClientMain {

    public static void main(String[] args) {

        Client client = ClientPool.create("127.0.0.1", 7081);
        Packet req = new Packet(PacketType.hotTest);

        try {
            client.send(req);
            TimeUnit.SECONDS.sleep(3L);
            req = new Packet(PacketType.heartbeat);

            while (true) {
                client.send(req);
                TimeUnit.SECONDS.sleep(3L);
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
}
